package com.wbc.smartHome.web;

import com.wbc.smartHome.model.HotSpot;
import com.wbc.smartHome.model.Result;
import com.wbc.smartHome.service.HotSpotService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping(path = "/api/hotSpotCtl")
/*热门话题存取*/
@Api(tags = "热点话题模块")
public class HotSpotController {


    @Autowired
    private HotSpotService hotSpotService;

    @ApiOperation("获取所有热点话题详细信息")
    @ApiResponses({
            @ApiResponse(code = 200 , message = "OK"),
            @ApiResponse(code = 500 , message = "系统异常")
    })
    @GetMapping(path = "getHotSpotList")
    public Result getHotSpotList() {
        List<HotSpot> hotSpotList = hotSpotService.getHotSpotList();
        return new Result(200, "OK", hotSpotList);
    }

    @ApiOperation("添加热点话题")
    @ApiResponses({
            @ApiResponse(code = 200 , message = "OK"),
            @ApiResponse(code = 500 , message = "系统异常")
    })
    @PostMapping(path = "setHotSpot")
    public Result setHotSpot(@RequestBody HotSpot hotSpot) {
        hotSpotService.setHotSpot(hotSpot);
        return new Result(200,"ok",null);
    }


}
